﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Assist;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.UI;
using YArchitech.Controls;
using YArchitech.LIB;
using YArchitech.Revit;
using YArchitech.Revit.RevitExtension;
using HYDragCurveJig;
using HYElectricKernel;
using TableTools;

namespace HYElectricDim
{
	internal class CableTrenchDraw
	{
		public CableTrenchDraw(ExternalCommandData cmdData, CableTrenchInfo cableTrench)
		{
			if (cmdData == null || cableTrench == null)
			{
				return;
			}
			this.m_cmdData = cmdData;
			this.m_doc = cmdData.Application.ActiveUIDocument.Document;
			this.GetSectionViewData(cableTrench);
			this.GetLineStyle(ref this.m_CTBodyStyle, ref this.m_WallStyle, ref this.m_GroundSteelStyle, ref this.m_EmbedSteelStyle);
			this.GetTextNodeType();
			this.m_DimensionLst = new List<CabelTrayDimension>();
			CabelTrayDimension item = new CabelTrayDimension(2);
			this.m_DimensionLst.Add(item);
			item = new CabelTrayDimension(5);
			this.m_DimensionLst.Add(item);
			item = new CabelTrayDimension(2);
			this.m_DimensionLst.Add(item);
			item = new CabelTrayDimension(8);
			this.m_DimensionLst.Add(item);
			item = new CabelTrayDimension(3);
			this.m_DimensionLst.Add(item);
			item = new CabelTrayDimension(2);
			this.m_DimensionLst.Add(item);
			this.m_TextDimLst = new List<CabelTrayTxtDim>();
		}

		private void GetTextNodeType()
		{
			IList<Element> list = new FilteredElementCollector(this.m_doc).OfClass(typeof(TextNoteType)).ToElements();
			if (list.Count <= 0)
			{
				return;
			}
			foreach (Element element in list)
			{
				TextNoteType textNoteType = element as TextNoteType;
				if (textNoteType.Name == "HY-文字标注-0.5")
				{
					this.m_dimTxtNoteType = textNoteType;
					return;
				}
			}
			TextNoteType textNoteType2 = list[0] as TextNoteType;
			Transaction transaction = new Transaction(this.m_doc, "Create New TextNoteType");
			transaction.Start();
			try
			{
				this.m_dimTxtNoteType = (textNoteType2.Duplicate("HY-文字标注-0.5") as TextNoteType);
				this.m_dimTxtNoteType.GetParameter(BuiltInParameter.TEXT_SIZE).Set(AssistFunc.mmToFeet(0.5));
				this.m_dimTxtNoteType.GetParameter(BuiltInParameter.LEADER_OFFSET_SHEET).Set(AssistFunc.mmToFeet(0.1));
				transaction.Commit();
			}
			catch
			{
				transaction.RollBack();
			}
		}

		private void GetSectionViewData(CableTrenchInfo cableTrench)
		{
			this.m_nWidth = cableTrench.Width;
			this.m_nDepth = cableTrench.Depth;
			this.m_nWallThick = cableTrench.WallThick;
			this.m_nDisThick = cableTrench.DisThick;
			this.m_bEmbedSteel = (cableTrench.EmbedSteel == "是");
			this.m_bGroundSteel = (cableTrench.GroundSteel == "是");
			this.m_nLength = cableTrench.Length;
			this.m_nFloorNum = cableTrench.FloorNum;
			this.m_nFloorGap = cableTrench.FloorGap;
			this.m_nTopDis = cableTrench.TopDis;
			this.m_strLeftOrRight = cableTrench.LeftOrRight;
			this.m_bHasBoard = (cableTrench.HasBoard == "是");
			this.m_nBoardThick = cableTrench.BoardThick;
			this.m_nBaseThick = cableTrench.BaseThick;
			this.m_nEdgeDis = cableTrench.EdgeDis;
			this.m_bHasCableTray = (cableTrench.HasCableTray == "是");
			this.m_nTrayWidth = cableTrench.TrayWidth;
			this.m_nTrayHeight = cableTrench.TrayHeight;
			this.m_bHasLabel = (cableTrench.HasLabel == "是");
			this.m_dGain = cableTrench.Gain;
		}

		private bool GetLineStyle(ref GraphicsStyle bodyStyle, ref GraphicsStyle wallStyle, ref GraphicsStyle groundSteelStyle, ref GraphicsStyle embedSteelStyle)
		{
			Category category = this.m_doc.Settings.Categories.get_Item(BuiltInCategory.OST_Lines);
			if (category == null)
			{
				return false;
			}
			string text = "CTBody" + string.Format(" {0}", 10);
			string text2 = "DisWall" + string.Format(" {0}", 10);
			string text3 = "GroundSteel" + string.Format(" {0}", 10);
			string text4 = "EmbedSteel" + string.Format(" {0}", 10);
			if (!category.SubCategories.Contains(text) && !this.CreateLineStyle(10, text, ref category))
			{
				return false;
			}
			if (!category.SubCategories.Contains(text2) && !this.CreateLineStyle(10, text2, ref category))
			{
				return false;
			}
			if (!category.SubCategories.Contains(text3) && !this.CreateLineStyle(10, text3, ref category))
			{
				return false;
			}
			if (!category.SubCategories.Contains(text4) && !this.CreateLineStyle(10, text4, ref category))
			{
				return false;
			}
			foreach (Element element in new FilteredElementCollector(this.m_doc).OfClass(typeof(GraphicsStyle)))
			{
				GraphicsStyle graphicsStyle = element as GraphicsStyle;
				if (graphicsStyle != null)
				{
					if (graphicsStyle.Name.CompareTo(text) == 0)
					{
						bodyStyle = graphicsStyle;
					}
					if (graphicsStyle.Name.CompareTo(text2) == 0)
					{
						wallStyle = graphicsStyle;
					}
					if (graphicsStyle.Name.CompareTo(text3) == 0)
					{
						groundSteelStyle = graphicsStyle;
					}
					if (graphicsStyle.Name.CompareTo(text4) == 0)
					{
						embedSteelStyle = graphicsStyle;
					}
				}
			}
			return bodyStyle != null && wallStyle != null && groundSteelStyle != null && embedSteelStyle != null;
		}

		private bool CreateLineStyle(int lineWidth, string typeName, ref Category lineCategory)
		{
			Transaction transaction = new Transaction(this.m_doc);
			bool result;
			try
			{
				transaction.Start("new line style");
				Category category = this.m_doc.Settings.Categories.NewSubcategory(lineCategory, typeName);
				if (typeName.IndexOf("CTBody") != -1)
				{
					category.LineColor = this.m_CTBodyColor;
					category.SetLineWeight(lineWidth, (Autodesk.Revit.DB.GraphicsStyleType)1);
				}
				else if (typeName.IndexOf("DisWall") != -1)
				{
					category.LineColor = this.m_WallColor;
					category.SetLineWeight(lineWidth, (Autodesk.Revit.DB.GraphicsStyleType)1);
				}
				else if (typeName.IndexOf("GroundSteel") != -1)
				{
					category.LineColor = this.m_GroundSteelColor;
					category.SetLineWeight(lineWidth, (Autodesk.Revit.DB.GraphicsStyleType)1);
				}
				else
				{
					category.LineColor = this.m_EmbedSteelColor;
					category.SetLineWeight(lineWidth, (Autodesk.Revit.DB.GraphicsStyleType)1);
				}
				transaction.Commit();
				result = true;
			}
			catch (Exception)
			{
				if (transaction != null && transaction.HasStarted() && !transaction.HasEnded())
				{
					transaction.RollBack();
				}
				result = false;
			}
			return result;
		}

		public void Drawing(int scale)
		{
			if (TableInterface.SwitchCableTrenchSectionView(this.m_cmdData) != null)
			{
				return;
			}
			Transaction transaction = new Transaction(this.m_doc, "Scale");
			transaction.Start();
			this.m_doc.ActiveView.Scale = scale;
			transaction.Commit();
			if (Geometry.LessThan((double)((this.m_nDepth - this.m_nTopDis) / (this.m_nFloorNum - 1)), (double)this.m_nFloorGap))
			{
				YJKMessageBox.Show("支架参数设置不合理，无法生成电缆剖面图!");
				return;
			}
			this.DrawBoard();
			this.DrawTop();
			this.DrawWall();
			this.DrawBase();
			if (this.m_bHasCableTray)
			{
				this.DrawSupportWithTray();
				this.DrawCableTray();
			}
			else
			{
				this.DrawSupportWithoutTray();
			}
			this.DrawDisWall();
			if (this.m_bGroundSteel)
			{
				this.DrawGroundSteel();
			}
			if (this.m_bEmbedSteel)
			{
				this.DrawEmbedSteel();
			}
			XYZ move = null;
			if (!this.DragJig(ref move))
			{
				return;
			}
			this.RealDrawing(move);
		}

		private bool DragJig(ref XYZ ptPos)
		{
			List<JigEdgeInfo> list = new List<JigEdgeInfo>();
			list.AddRange(this.GetJigEdgeInfoList(this.m_BoardInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_TopLeftInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_TopRightInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_WallLeftInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_WallRightInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_BaseInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_LSupportInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_RSupportInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_DisWallLineInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_LGroudSteelLineInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_RGroudSteelLineInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_LCabelTrayLineInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_RCabelTrayLineInfos));
			list.AddRange(this.GetJigEdgeInfoList(this.m_EmbedSteelLineInfos));
			try
			{
				if (!DragCurveJigInterface.GetInsertPosition(this.m_cmdData, list, false, XYZ.Zero, ref ptPos))
				{
					return false;
				}
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}

		private bool RealDrawing(XYZ move)
		{
			Transaction transaction = new Transaction(this.m_doc);
			bool result;
			try
			{
				transaction.Start("drawing");
				this.m_cmdData.Application.Application.FailuresProcessing += this.OnFailuresProcessing;
				Application application = this.m_cmdData.Application.Application;
				Transform transform = RevitVersionFuncs.CreateTranslation(move);
				this.DrawAndCroup(this.m_BoardInfos, this.m_CTBodyStyle, transform, application);
				if (this.m_bHasBoard)
				{
					this.FillRegion(this.GetJigEdgeInfoList(this.m_BoardInfos), application, "盖板");
				}
				this.DrawAndCroup(this.m_TopLeftInfos, this.m_CTBodyStyle, transform, application);
				foreach (JigEdgeInfo jigEdgeInfo in this.m_TopLeftRegion)
				{
					jigEdgeInfo.TransformSelf(transform);
				}
				this.FillRegion(this.m_TopLeftRegion, application, "顶");
				this.DrawAndCroup(this.m_TopRightInfos, this.m_CTBodyStyle, transform, application);
				foreach (JigEdgeInfo jigEdgeInfo2 in this.m_TopRightRegion)
				{
					jigEdgeInfo2.TransformSelf(transform);
				}
				this.FillRegion(this.m_TopRightRegion, application, "顶");
				this.DrawAndCroup(this.m_WallLeftInfos, this.m_CTBodyStyle, transform, application);
				this.FillRegion(this.GetJigEdgeInfoList(this.m_WallLeftInfos), application, "墙体");
				this.DrawAndCroup(this.m_WallRightInfos, this.m_CTBodyStyle, transform, application);
				this.FillRegion(this.GetJigEdgeInfoList(this.m_WallRightInfos), application, "墙体");
				this.DrawAndCroup(this.m_BaseInfos, this.m_CTBodyStyle, transform, application);
				this.FillRegion(this.GetJigEdgeInfoList(this.m_BaseInfos), application, "底");
				this.DrawAndCroup(this.m_LSupportInfos, this.m_CTBodyStyle, transform, application);
				this.DrawAndCroup(this.m_RSupportInfos, this.m_CTBodyStyle, transform, application);
				this.DrawAndCroup(this.m_DisWallLineInfos, this.m_WallStyle, transform, application);
				this.DrawAndCroup(this.m_LGroudSteelLineInfos, this.m_GroundSteelStyle, transform, application);
				this.DrawAndCroup(this.m_RGroudSteelLineInfos, this.m_GroundSteelStyle, transform, application);
				this.DrawAndCroup(this.m_EmbedSteelLineInfos, this.m_EmbedSteelStyle, transform, application);
				this.DrawAndCroup(this.m_LCabelTrayLineInfos, this.m_GroundSteelStyle, transform, application);
				this.DrawAndCroup(this.m_RCabelTrayLineInfos, this.m_GroundSteelStyle, transform, application);
				transaction.Commit();
				transaction.Start();
				if (this.m_bHasLabel)
				{
					DimensionType deimensionType = this.GetDeimensionType();
					this.CreateLabel(transform, deimensionType);
				}
				this.CreateTextLabel(transform);
				transaction.Commit();
				result = true;
			}
			catch (Exception)
			{
				transaction.RollBack();
				result = false;
			}
			return result;
		}

		private void OnFailuresProcessing(object sender, FailuresProcessingEventArgs e)
		{
			e.GetFailuresAccessor().DeleteAllWarnings();
		}

		private DimensionType GetDeimensionType()
		{
			int scale = this.m_doc.ActiveView.Scale;
			string text = "HY-3.5-长仿宋-0.8(左下)";
			string strMark = "对角线 1.0mm";
			if (scale <= 10)
			{
				if (scale == 1)
				{
					text = "HY-35-长仿宋-0.8(左下)";
					strMark = "对角线 10mm";
					goto IL_7D;
				}
				if (scale == 10)
				{
					text = "HY-3.5-长仿宋-0.8(左下)";
					strMark = "对角线 1.0mm";
					goto IL_7D;
				}
			}
			else
			{
				if (scale == 50)
				{
					text = "HY-0.7-长仿宋-0.8(左下)";
					strMark = "对角线 0.2mm";
					goto IL_7D;
				}
				if (scale == 100)
				{
					text = "HY-0.35-长仿宋-0.8(左下)";
					strMark = "对角线 0.1mm";
					goto IL_7D;
				}
			}
			text = "HY-3.5-长仿宋-0.8(左下)";
			strMark = "对角线 1.0mm";
			IL_7D:
			DimensionType dimensionType = null;
			foreach (Element element in new FilteredElementCollector(this.m_doc).OfClass(typeof(DimensionType)).ToElements())
			{
				if (element.Name == text)
				{
					dimensionType = (element as DimensionType);
					break;
				}
			}
			if (dimensionType == null)
			{
				dimensionType = this.CopyDimensionType(text, strMark);
			}
			return dimensionType;
		}

		private void DrawAndCroup(List<JigEdgeInfoEx> lstInfosEx, GraphicsStyle lineStyle, Transform moveTransf, Autodesk.Revit.ApplicationServices.Application app)
		{
			ElementSet elementSet = new ElementSet();
			foreach (JigEdgeInfoEx jigEdgeInfoEx in lstInfosEx)
			{
				JigEdgeInfo jigEdgeInfo = jigEdgeInfoEx.m_JigEdgeInfo;
				jigEdgeInfo.TransformSelf(moveTransf);
				Curve curve = jigEdgeInfo.ConvertTo(app);
				DetailCurve detailCurve = this.DrawCurve(curve, lineStyle);
				foreach (DimensionPair dimensionPair in jigEdgeInfoEx.dimensionPairLst)
				{
					this.m_DimensionLst[dimensionPair.DimensionIndex].m_elemIdAry[dimensionPair.ItemIndex] = detailCurve.Id;
				}
				elementSet.Insert(detailCurve);
			}
			if (elementSet.Size > 0)
			{
				this.m_doc.CreatYJKGroup(elementSet);
			}
		}

		private void FillRegion(List<JigEdgeInfo> lstInfos, Autodesk.Revit.ApplicationServices.Application app, string name)
		{
			List<Curve> list = new List<Curve>();
			foreach (JigEdgeInfo jigEdgeInfo in lstInfos)
			{
				Curve item = jigEdgeInfo.ConvertTo(app);
				list.Add(item);
			}
			if (list.Count <= 0)
			{
				return;
			}
			List<CurveLoop> list2 = new List<CurveLoop>();
			list2.Add(CurveLoop.Create(list));
			FilledRegionType filledRegionType;
			if (name == "盖板" || name == "墙体")
			{
				filledRegionType = this.GetForwardDiagonal();
			}
			else
			{
				filledRegionType = this.GetConcrete();
			}
			if (filledRegionType != null)
			{
				FilledRegion.Create(this.m_doc, filledRegionType.Id, this.m_doc.ActiveView.Id, list2);
			}
		}

		private DetailCurve DrawCurve(Curve curve, GraphicsStyle lineStyle)
		{
			DetailCurve result;
			try
			{
				Autodesk.Revit.DB.View activeView = this.m_cmdData.Application.ActiveUIDocument.ActiveView;
				DetailCurve detailCurve = this.m_cmdData.Application.ActiveUIDocument.Document.Create.NewDetailCurve(activeView, curve);
				if (detailCurve != null)
				{
					detailCurve.LineStyle = lineStyle;
				}
				result = detailCurve;
			}
			catch (Exception)
			{
				result = null;
			}
			return result;
		}

		private void DrawBoard()
		{
			if (this.m_bHasBoard)
			{
				double num = (double)(this.m_nWidth + 80);
				XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(num * 0.5 * this.m_dGain);
				XYZ xyz2 = this.m_ptBase + XYZ.BasisX * AssistFunc.mmToFeet(num * 0.5 * this.m_dGain);
				XYZ xyz3 = xyz - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBoardThick * this.m_dGain);
				XYZ xyz4 = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBoardThick * this.m_dGain);
				this.m_BoardInfos.Add(new JigEdgeInfoEx(xyz3, xyz));
				JigEdgeInfoEx jigEdgeInfoEx = new JigEdgeInfoEx(xyz, xyz2);
				jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(1, 0));
				this.m_BoardInfos.Add(jigEdgeInfoEx);
				this.m_BoardInfos.Add(new JigEdgeInfoEx(xyz2, xyz4));
				jigEdgeInfoEx = new JigEdgeInfoEx(xyz4, xyz3);
				jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(1, 1));
				jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(4, 0));
				this.m_BoardInfos.Add(jigEdgeInfoEx);
				JigTextInfo txtInfo = new JigTextInfo(this.m_dimTxtNoteType, this.m_ptBase + XYZ.BasisY * AssistFunc.mmToFeet(100.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)128, AssistFunc.mmToFeet(2.0), "盖板");
				this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo, null));
			}
			else
			{
				double val = 1.0;
				XYZ ptBase = this.m_ptBase;
				XYZ xyz5 = this.m_ptBase + XYZ.BasisX * AssistFunc.mmToFeet(val);
				XYZ endPoint = ptBase - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBoardThick);
				XYZ startPoint = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBoardThick);
				JigEdgeInfoEx jigEdgeInfoEx2 = new JigEdgeInfoEx(ptBase, xyz5);
				jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(1, 0));
				this.m_BoardInfos.Add(jigEdgeInfoEx2);
				jigEdgeInfoEx2 = new JigEdgeInfoEx(startPoint, endPoint);
				jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(1, 1));
				jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(4, 0));
				this.m_BoardInfos.Add(jigEdgeInfoEx2);
			}
			CabelTrayDimension cabelTrayDimension = this.m_DimensionLst[4];
			cabelTrayDimension.m_ptStart = this.m_ptBase - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBoardThick);
			cabelTrayDimension.m_ptEnd = cabelTrayDimension.m_ptStart - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nDepth);
			this.m_DimensionLst[4] = cabelTrayDimension;
		}

		private void DrawTop()
		{
			double num = (double)(this.m_nWidth + 80);
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(num * 0.5 * this.m_dGain);
			XYZ xyz2 = xyz - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBoardThick * this.m_dGain);
			XYZ xyz3 = xyz2 + XYZ.BasisX * AssistFunc.mmToFeet(40.0) * this.m_dGain;
			XYZ xyz4 = xyz3 - XYZ.BasisY * AssistFunc.mmToFeet((double)(150 - this.m_nBoardThick) * this.m_dGain);
			XYZ xyz5 = xyz4 - XYZ.BasisX * AssistFunc.mmToFeet(440.0 * this.m_dGain);
			XYZ xyz6 = xyz5 + XYZ.BasisY * AssistFunc.mmToFeet(150.0 * this.m_dGain);
			XYZ startPoint = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet(40.0 * this.m_dGain);
			XYZ xyz7 = xyz5 + XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
			XYZ xyz8 = xyz7 - XYZ.BasisX * AssistFunc.mmToFeet(20.0 * this.m_dGain);
			XYZ endPoint = xyz6 + XYZ.BasisY * AssistFunc.mmToFeet(40.0 * this.m_dGain);
			XYZ xyz9 = xyz6 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
			XYZ xyz10 = xyz9 + XYZ.BasisX * AssistFunc.mmToFeet(20.0 * this.m_dGain);
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(startPoint, xyz7));
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz7, xyz8));
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz8, xyz10));
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz10, xyz9));
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz9, endPoint));
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz5, xyz4));
			JigEdgeInfoEx jigEdgeInfoEx = new JigEdgeInfoEx(xyz6, xyz);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(0, 0));
			this.m_TopLeftInfos.Add(jigEdgeInfoEx);
			CabelTrayDimension cabelTrayDimension = this.m_DimensionLst[0];
			cabelTrayDimension.m_ptStart = xyz6 - XYZ.BasisX * AssistFunc.mmToFeet(150.0);
			this.m_DimensionLst[0] = cabelTrayDimension;
			cabelTrayDimension = this.m_DimensionLst[1];
			cabelTrayDimension.m_ptStart = xyz6 - XYZ.BasisX * AssistFunc.mmToFeet(80.0);
			this.m_DimensionLst[1] = cabelTrayDimension;
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz, xyz2));
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz2, xyz3));
			this.m_TopLeftInfos.Add(new JigEdgeInfoEx(xyz3, xyz4));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz5, xyz7, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz7, xyz8, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz8, xyz10, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz10, xyz9, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz9, xyz6, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz6, xyz, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz, xyz2, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz2, xyz3, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz3, xyz4, 0.0));
			this.m_TopLeftRegion.Add(new JigEdgeInfo(xyz4, xyz5, 0.0));
			XYZ xyz11 = this.m_ptBase + XYZ.BasisX * AssistFunc.mmToFeet(num * 0.5 * this.m_dGain);
			XYZ xyz12 = xyz11 - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBoardThick * this.m_dGain);
			XYZ xyz13 = xyz12 - XYZ.BasisX * AssistFunc.mmToFeet(40.0 * this.m_dGain);
			XYZ xyz14 = xyz13 - XYZ.BasisY * AssistFunc.mmToFeet((double)(150 - this.m_nBoardThick) * this.m_dGain);
			XYZ xyz15 = xyz14 + XYZ.BasisX * AssistFunc.mmToFeet(440.0 * this.m_dGain);
			XYZ xyz16 = xyz15 + XYZ.BasisY * AssistFunc.mmToFeet(150.0 * this.m_dGain);
			XYZ startPoint2 = xyz15 - XYZ.BasisY * AssistFunc.mmToFeet(40.0 * this.m_dGain);
			XYZ xyz17 = xyz15 + XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
			XYZ xyz18 = xyz17 + XYZ.BasisX * AssistFunc.mmToFeet(20.0 * this.m_dGain);
			XYZ endPoint2 = xyz16 + XYZ.BasisY * AssistFunc.mmToFeet(40.0 * this.m_dGain);
			XYZ xyz19 = xyz16 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
			XYZ xyz20 = xyz19 - XYZ.BasisX * AssistFunc.mmToFeet(20.0 * this.m_dGain);
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(startPoint2, xyz17));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz17, xyz18));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz18, xyz20));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz20, xyz19));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz19, endPoint2));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz15, xyz14));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz16, xyz11));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz11, xyz12));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz12, xyz13));
			this.m_TopRightInfos.Add(new JigEdgeInfoEx(xyz13, xyz14));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz15, xyz17, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz17, xyz18, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz18, xyz20, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz20, xyz19, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz19, xyz16, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz16, xyz11, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz11, xyz12, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz12, xyz13, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz13, xyz14, 0.0));
			this.m_TopRightRegion.Add(new JigEdgeInfo(xyz14, xyz15, 0.0));
		}

		private void DrawWall()
		{
			double num = (double)(this.m_nDepth + this.m_nBoardThick + this.m_nDisThick - 150);
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(((double)this.m_nWidth * 0.5 + (double)this.m_nWallThick) * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet(150.0 * this.m_dGain);
			XYZ xyz2 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nWallThick * this.m_dGain);
			XYZ xyz3 = xyz - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
			XYZ xyz4 = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
			JigEdgeInfoEx jigEdgeInfoEx = new JigEdgeInfoEx(xyz3, xyz);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 1));
			this.m_WallLeftInfos.Add(jigEdgeInfoEx);
			this.m_WallLeftInfos.Add(new JigEdgeInfoEx(xyz, xyz2));
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz2, xyz4);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 2));
			this.m_WallLeftInfos.Add(jigEdgeInfoEx);
			this.m_WallLeftInfos.Add(new JigEdgeInfoEx(xyz4, xyz3));
			XYZ xyz5 = this.m_ptBase + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nWidth * 0.5 * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet(150.0 * this.m_dGain);
			XYZ xyz6 = xyz5 + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nWallThick * this.m_dGain);
			XYZ xyz7 = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
			XYZ xyz8 = xyz6 - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz7, xyz5);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 5));
			this.m_WallRightInfos.Add(jigEdgeInfoEx);
			this.m_WallRightInfos.Add(new JigEdgeInfoEx(xyz5, xyz6));
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz6, xyz8);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 6));
			this.m_WallRightInfos.Add(jigEdgeInfoEx);
			this.m_WallRightInfos.Add(new JigEdgeInfoEx(xyz8, xyz7));
		}

		private void DrawBase()
		{
			double num = (double)this.m_nWidth * 0.5 + (double)this.m_nWallThick + (double)this.m_nEdgeDis;
			XYZ xyz = this.m_ptBase - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nDepth + this.m_nBoardThick + this.m_nDisThick) * this.m_dGain) - XYZ.BasisX * AssistFunc.mmToFeet(num * this.m_dGain);
			XYZ xyz2 = xyz + XYZ.BasisX * AssistFunc.mmToFeet(num * 2.0 * this.m_dGain);
			XYZ xyz3 = xyz - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBaseThick * this.m_dGain);
			XYZ xyz4 = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nBaseThick * this.m_dGain);
			JigEdgeInfoEx jigEdgeInfoEx = new JigEdgeInfoEx(xyz3, xyz);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(2, 0));
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 0));
			this.m_BaseInfos.Add(jigEdgeInfoEx);
			this.m_BaseInfos.Add(new JigEdgeInfoEx(xyz, xyz2));
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz2, xyz4);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(2, 1));
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 7));
			this.m_BaseInfos.Add(jigEdgeInfoEx);
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz4, xyz3);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(1, 4));
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(0, 1));
			this.m_BaseInfos.Add(jigEdgeInfoEx);
			CabelTrayDimension cabelTrayDimension = this.m_DimensionLst[0];
			XYZ ptEnd = new XYZ(cabelTrayDimension.m_ptStart.X, xyz3.Y, xyz3.Z);
			cabelTrayDimension.m_ptEnd = ptEnd;
			this.m_DimensionLst[0] = cabelTrayDimension;
			cabelTrayDimension = this.m_DimensionLst[1];
			ptEnd = new XYZ(cabelTrayDimension.m_ptStart.X, xyz3.Y, xyz3.Z);
			cabelTrayDimension.m_ptEnd = ptEnd;
			this.m_DimensionLst[1] = cabelTrayDimension;
			cabelTrayDimension = this.m_DimensionLst[2];
			cabelTrayDimension.m_ptStart = xyz3 - XYZ.BasisY * AssistFunc.mmToFeet(150.0 * this.m_dGain);
			cabelTrayDimension.m_ptEnd = xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(150.0 * this.m_dGain);
			this.m_DimensionLst[2] = cabelTrayDimension;
			cabelTrayDimension = this.m_DimensionLst[3];
			cabelTrayDimension.m_ptStart = xyz3 - XYZ.BasisY * AssistFunc.mmToFeet(80.0 * this.m_dGain);
			cabelTrayDimension.m_ptEnd = xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(80.0 * this.m_dGain);
			this.m_DimensionLst[3] = cabelTrayDimension;
		}

		private void DrawDisWall()
		{
			double num = (double)(this.m_nDepth + this.m_nDisThick - 25);
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nWidth * 0.5 * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nBoardThick + 25) * this.m_dGain);
			XYZ xyz2 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nDisThick * this.m_dGain);
			XYZ xyz3 = xyz - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
			XYZ xyz4 = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet((num - (double)this.m_nDisThick) * this.m_dGain);
			XYZ xyz5 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nWidth * this.m_dGain);
			XYZ xyz6 = xyz5 - XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nDisThick * this.m_dGain);
			XYZ xyz7 = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
			XYZ xyz8 = xyz6 - XYZ.BasisY * AssistFunc.mmToFeet((num - (double)this.m_nDisThick) * this.m_dGain);
			this.m_DisWallLineInfos.Add(new JigEdgeInfoEx(xyz3, xyz));
			this.m_DisWallLineInfos.Add(new JigEdgeInfoEx(xyz, xyz2));
			JigEdgeInfoEx jigEdgeInfoEx = new JigEdgeInfoEx(xyz2, xyz4);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 3));
			this.m_DisWallLineInfos.Add(jigEdgeInfoEx);
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz4, xyz8);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(1, 2));
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(4, 2));
			this.m_DisWallLineInfos.Add(jigEdgeInfoEx);
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz8, xyz6);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(3, 4));
			this.m_DisWallLineInfos.Add(jigEdgeInfoEx);
			this.m_DisWallLineInfos.Add(new JigEdgeInfoEx(xyz6, xyz5));
			this.m_DisWallLineInfos.Add(new JigEdgeInfoEx(xyz5, xyz7));
			jigEdgeInfoEx = new JigEdgeInfoEx(xyz7, xyz3);
			jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(1, 3));
			this.m_DisWallLineInfos.Add(jigEdgeInfoEx);
		}

		private void DrawGroundSteel()
		{
			double num = (double)(this.m_nDepth - 25 - 35 - 85);
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(((double)this.m_nWidth * 0.5 - (double)this.m_nDisThick) * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nBoardThick + 25 + 35) * this.m_dGain);
			if (this.m_strLeftOrRight.Contains("左"))
			{
				XYZ xyz2 = xyz + XYZ.BasisX * AssistFunc.mmToFeet(15.0 * this.m_dGain);
				XYZ startPoint = xyz - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
				XYZ endPoint = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
				this.m_LGroudSteelLineInfos.Add(new JigEdgeInfoEx(startPoint, xyz));
				this.m_LGroudSteelLineInfos.Add(new JigEdgeInfoEx(xyz, xyz2));
				this.m_LGroudSteelLineInfos.Add(new JigEdgeInfoEx(xyz2, endPoint));
				this.m_LGroudSteelLineInfos.Add(new JigEdgeInfoEx(startPoint, endPoint));
			}
			if (this.m_strLeftOrRight.Contains("右"))
			{
				XYZ xyz3 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nWidth - this.m_nDisThick * 2) * this.m_dGain);
				XYZ xyz4 = xyz3 - XYZ.BasisX * AssistFunc.mmToFeet(15.0 * this.m_dGain);
				XYZ startPoint2 = xyz3 - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
				XYZ endPoint2 = xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(num * this.m_dGain);
				this.m_RGroudSteelLineInfos.Add(new JigEdgeInfoEx(startPoint2, xyz3));
				this.m_RGroudSteelLineInfos.Add(new JigEdgeInfoEx(xyz3, xyz4));
				this.m_RGroudSteelLineInfos.Add(new JigEdgeInfoEx(xyz4, endPoint2));
				this.m_RGroudSteelLineInfos.Add(new JigEdgeInfoEx(startPoint2, endPoint2));
				List<XYZ> list = new List<XYZ>();
				list.Add(xyz4 + XYZ.BasisX * AssistFunc.mmToFeet(8.0 * this.m_dGain));
				XYZ xyz5 = xyz4 + XYZ.BasisY * AssistFunc.mmToFeet(100.0);
				list.Add(xyz5);
				JigTextInfo txtInfo = new JigTextInfo(this.m_dimTxtNoteType, xyz5 + XYZ.BasisY * AssistFunc.mmToFeet(80.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)128, AssistFunc.mmToFeet(3.0), "接地扁钢");
				this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo, list));
			}
		}

		private void DrawSupportWithoutTray()
		{
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(((double)this.m_nWidth * 0.5 - (double)this.m_nDisThick) * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nTopDis + this.m_nBoardThick - 40) * this.m_dGain);
			if (this.m_strLeftOrRight.Contains("左"))
			{
				XYZ xyz2 = xyz + XYZ.BasisX * AssistFunc.mmToFeet(25.0 * this.m_dGain);
				XYZ startPoint = xyz - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nFloorGap * (this.m_nFloorNum - 1) + 80 + 25) * this.m_dGain);
				XYZ endPoint = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nFloorGap * (this.m_nFloorNum - 1) + 80 + 25) * this.m_dGain);
				this.m_LSupportInfos.Add(new JigEdgeInfoEx(startPoint, xyz));
				this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz, xyz2));
				JigEdgeInfoEx jigEdgeInfoEx = new JigEdgeInfoEx(xyz2, endPoint);
				jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(5, 0));
				this.m_LSupportInfos.Add(jigEdgeInfoEx);
				this.m_LSupportInfos.Add(new JigEdgeInfoEx(startPoint, endPoint));
				XYZ xyz3 = null;
				for (int i = 0; i < this.m_nFloorNum; i++)
				{
					XYZ xyz4 = xyz - XYZ.BasisY * AssistFunc.mmToFeet((double)(40 + i * this.m_nFloorGap) * this.m_dGain);
					XYZ xyz5 = xyz4 + XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nLength + 25) * this.m_dGain);
					XYZ xyz6 = xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(25.0 * this.m_dGain);
					XYZ endPoint2 = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet(25.0 * this.m_dGain);
					XYZ startPoint2 = xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(5.0 * this.m_dGain);
					XYZ endPoint3 = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet(5.0 * this.m_dGain);
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz6, xyz4));
					if (i == 0)
					{
						jigEdgeInfoEx = new JigEdgeInfoEx(xyz4, xyz5);
						jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(4, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx);
						jigEdgeInfoEx = new JigEdgeInfoEx(xyz5, endPoint2);
						jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(5, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx);
						CabelTrayDimension cabelTrayDimension = this.m_DimensionLst[5];
						cabelTrayDimension.m_ptStart = xyz4 + XYZ.BasisX * AssistFunc.mmToFeet(25.0 * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						cabelTrayDimension.m_ptEnd = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						this.m_DimensionLst[5] = cabelTrayDimension;
					}
					else
					{
						this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz4, xyz5));
						this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz5, endPoint2));
					}
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz6, endPoint2));
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(startPoint2, endPoint3));
					xyz3 = xyz6 + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nLength * 0.8 * this.m_dGain);
				}
				List<XYZ> list = new List<XYZ>();
				XYZ xyz7 = xyz3;
				list.Add(xyz7);
				xyz7 -= XYZ.BasisY * AssistFunc.mmToFeet(50.0);
				list.Add(xyz7);
				JigTextInfo txtInfo = new JigTextInfo(this.m_dimTxtNoteType, xyz7 - XYZ.BasisY * AssistFunc.mmToFeet(10.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)128, AssistFunc.mmToFeet(2.0), "支架");
				this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo, list));
			}
			if (this.m_strLeftOrRight.Contains("右"))
			{
				XYZ xyz8 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nWidth - this.m_nDisThick * 2) * this.m_dGain);
				XYZ xyz9 = xyz8 - XYZ.BasisX * AssistFunc.mmToFeet(25.0 * this.m_dGain);
				XYZ startPoint3 = xyz8 - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nFloorGap * (this.m_nFloorNum - 1) + 80 + 25) * this.m_dGain);
				XYZ endPoint4 = xyz9 - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nFloorGap * (this.m_nFloorNum - 1) + 80 + 25) * this.m_dGain);
				this.m_RSupportInfos.Add(new JigEdgeInfoEx(startPoint3, xyz8));
				this.m_RSupportInfos.Add(new JigEdgeInfoEx(xyz8, xyz9));
				XYZ xyz10 = null;
				if (!this.m_strLeftOrRight.Contains("左"))
				{
					JigEdgeInfoEx jigEdgeInfoEx2 = new JigEdgeInfoEx(xyz9, endPoint4);
					jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(5, 0));
					this.m_LSupportInfos.Add(jigEdgeInfoEx2);
				}
				else
				{
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz9, endPoint4));
				}
				this.m_RSupportInfos.Add(new JigEdgeInfoEx(startPoint3, endPoint4));
				for (int j = 0; j < this.m_nFloorNum; j++)
				{
					XYZ xyz11 = xyz8 - XYZ.BasisY * AssistFunc.mmToFeet((double)(40 + j * this.m_nFloorGap) * this.m_dGain);
					XYZ xyz12 = xyz11 - XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nLength + 25) * this.m_dGain);
					XYZ xyz13 = xyz11 - XYZ.BasisY * AssistFunc.mmToFeet(25.0 * this.m_dGain);
					XYZ endPoint5 = xyz12 - XYZ.BasisY * AssistFunc.mmToFeet(25.0 * this.m_dGain);
					XYZ startPoint4 = xyz11 - XYZ.BasisY * AssistFunc.mmToFeet(5.0 * this.m_dGain);
					XYZ endPoint6 = xyz12 - XYZ.BasisY * AssistFunc.mmToFeet(5.0 * this.m_dGain);
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz13, xyz11));
					if (!this.m_strLeftOrRight.Contains("左") && j == 0)
					{
						JigEdgeInfoEx jigEdgeInfoEx2 = new JigEdgeInfoEx(xyz11, xyz12);
						jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(4, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx2);
						jigEdgeInfoEx2 = new JigEdgeInfoEx(xyz12, endPoint5);
						jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(5, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx2);
						CabelTrayDimension cabelTrayDimension2 = this.m_DimensionLst[5];
						cabelTrayDimension2.m_ptStart = xyz11 - XYZ.BasisX * AssistFunc.mmToFeet(25.0 * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						cabelTrayDimension2.m_ptEnd = xyz12 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						this.m_DimensionLst[5] = cabelTrayDimension2;
					}
					else
					{
						this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz11, xyz12));
						this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz12, endPoint5));
					}
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz13, endPoint5));
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(startPoint4, endPoint6));
					xyz10 = xyz13 - XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nLength * 0.8 * this.m_dGain);
				}
				if (!this.m_strLeftOrRight.Contains("左"))
				{
					List<XYZ> list2 = new List<XYZ>();
					XYZ xyz14 = xyz10;
					list2.Add(xyz14);
					xyz14 -= XYZ.BasisY * AssistFunc.mmToFeet(50.0);
					list2.Add(xyz14);
					JigTextInfo txtInfo2 = new JigTextInfo(this.m_dimTxtNoteType, xyz14 - XYZ.BasisY * AssistFunc.mmToFeet(10.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)128, AssistFunc.mmToFeet(2.0), "支架");
					this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo2, list2));
				}
			}
		}

		private void DrawSupportWithTray()
		{
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(((double)this.m_nWidth * 0.5 - (double)this.m_nDisThick) * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nBoardThick + this.m_nTopDis) * this.m_dGain);
			if (this.m_strLeftOrRight.Contains("左"))
			{
				XYZ xyz2 = null;
				for (int i = 0; i < this.m_nFloorNum; i++)
				{
					XYZ xyz3 = xyz - XYZ.BasisY * AssistFunc.mmToFeet((double)(i * this.m_nFloorGap) * this.m_dGain);
					XYZ xyz4 = xyz3 + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nLength * this.m_dGain);
					XYZ xyz5 = xyz3 - XYZ.BasisY * AssistFunc.mmToFeet(25.0 * this.m_dGain);
					if (i == 0)
					{
						JigEdgeInfoEx jigEdgeInfoEx = new JigEdgeInfoEx(xyz5, xyz3);
						jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(5, 0));
						this.m_LSupportInfos.Add(jigEdgeInfoEx);
						jigEdgeInfoEx = new JigEdgeInfoEx(xyz3, xyz4);
						jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(4, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx);
						jigEdgeInfoEx = new JigEdgeInfoEx(xyz4, xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(1.0));
						jigEdgeInfoEx.dimensionPairLst.Add(new DimensionPair(5, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx);
						CabelTrayDimension cabelTrayDimension = this.m_DimensionLst[5];
						cabelTrayDimension.m_ptStart = xyz3 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						cabelTrayDimension.m_ptEnd = xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						this.m_DimensionLst[5] = cabelTrayDimension;
					}
					else
					{
						this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz5, xyz3));
						this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz3, xyz4));
					}
					this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz5, xyz4));
					xyz2 = xyz5 + (xyz4 - xyz5) * AssistFunc.mmToFeet((double)this.m_nLength * 0.8 * this.m_dGain);
				}
				List<XYZ> list = new List<XYZ>();
				XYZ xyz6 = xyz2;
				list.Add(xyz6);
				xyz6 -= XYZ.BasisY * AssistFunc.mmToFeet(50.0);
				list.Add(xyz6);
				JigTextInfo txtInfo = new JigTextInfo(this.m_dimTxtNoteType, xyz6 - XYZ.BasisY * AssistFunc.mmToFeet(10.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)128, AssistFunc.mmToFeet(2.0), "支架");
				this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo, list));
			}
			XYZ xyz7 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nWidth - this.m_nDisThick * 2) * this.m_dGain);
			if (this.m_strLeftOrRight.Contains("右"))
			{
				XYZ xyz8 = null;
				for (int j = 0; j < this.m_nFloorNum; j++)
				{
					XYZ xyz9 = xyz7 - XYZ.BasisY * AssistFunc.mmToFeet((double)(j * this.m_nFloorGap) * this.m_dGain);
					XYZ xyz10 = xyz9 - XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nLength * this.m_dGain);
					XYZ xyz11 = xyz9 - XYZ.BasisY * AssistFunc.mmToFeet(25.0 * this.m_dGain);
					if (!this.m_strLeftOrRight.Contains("左") && j == 0)
					{
						JigEdgeInfoEx jigEdgeInfoEx2 = new JigEdgeInfoEx(xyz11, xyz9);
						jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(5, 0));
						this.m_RSupportInfos.Add(jigEdgeInfoEx2);
						jigEdgeInfoEx2 = new JigEdgeInfoEx(xyz9, xyz10);
						jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(4, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx2);
						jigEdgeInfoEx2 = new JigEdgeInfoEx(xyz10, xyz10 - XYZ.BasisY * AssistFunc.mmToFeet(1.0));
						jigEdgeInfoEx2.dimensionPairLst.Add(new DimensionPair(5, 1));
						this.m_LSupportInfos.Add(jigEdgeInfoEx2);
						CabelTrayDimension cabelTrayDimension2 = this.m_DimensionLst[5];
						cabelTrayDimension2.m_ptStart = xyz9 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						cabelTrayDimension2.m_ptEnd = xyz10 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
						this.m_DimensionLst[5] = cabelTrayDimension2;
					}
					else
					{
						this.m_RSupportInfos.Add(new JigEdgeInfoEx(xyz11, xyz9));
						this.m_LSupportInfos.Add(new JigEdgeInfoEx(xyz9, xyz10));
					}
					this.m_RSupportInfos.Add(new JigEdgeInfoEx(xyz11, xyz10));
					xyz8 = xyz11 + (xyz10 - xyz11) * AssistFunc.mmToFeet((double)this.m_nLength * 0.8 * this.m_dGain);
				}
				if (!this.m_strLeftOrRight.Contains("左"))
				{
					List<XYZ> list2 = new List<XYZ>();
					XYZ xyz12 = xyz8;
					list2.Add(xyz12);
					xyz12 -= XYZ.BasisY * AssistFunc.mmToFeet(50.0);
					list2.Add(xyz12);
					JigTextInfo txtInfo2 = new JigTextInfo(this.m_dimTxtNoteType, xyz12 - XYZ.BasisY * AssistFunc.mmToFeet(10.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)128, AssistFunc.mmToFeet(2.0), "支架");
					this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo2, list2));
				}
			}
		}

		private void DrawEmbedSteel()
		{
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(((double)this.m_nWidth * 0.5 - (double)this.m_nDisThick) * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nBoardThick + this.m_nTopDis) * this.m_dGain);
			if (this.m_strLeftOrRight.Contains("左"))
			{
				XYZ xyz2 = xyz - XYZ.BasisX * AssistFunc.mmToFeet(150.0 * this.m_dGain);
				XYZ endPoint = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz, xyz2));
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz2, endPoint));
				XYZ xyz3 = xyz - XYZ.BasisY * AssistFunc.mmToFeet((double)((this.m_nFloorNum - 1) * this.m_nFloorGap) * this.m_dGain);
				XYZ xyz4 = xyz3 - XYZ.BasisX * AssistFunc.mmToFeet(150.0 * this.m_dGain);
				XYZ endPoint2 = xyz4 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz3, xyz4));
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz4, endPoint2));
			}
			if (this.m_strLeftOrRight.Contains("右"))
			{
				XYZ xyz5 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nWidth - this.m_nDisThick * 2) * this.m_dGain);
				XYZ xyz6 = xyz5 + XYZ.BasisX * AssistFunc.mmToFeet(150.0 * this.m_dGain);
				XYZ endPoint3 = xyz6 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz5, xyz6));
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz6, endPoint3));
				List<XYZ> list = new List<XYZ>();
				list.Add(xyz6);
				XYZ xyz7 = xyz6 + XYZ.BasisX * AssistFunc.mmToFeet(150.0) - XYZ.BasisY * AssistFunc.mmToFeet(100.0);
				list.Add(xyz7);
				JigTextInfo txtInfo = new JigTextInfo(this.m_dimTxtNoteType, xyz7 + XYZ.BasisX * AssistFunc.mmToFeet(20.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)64, AssistFunc.mmToFeet(3.0), "预埋钢筋");
				this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo, list));
				XYZ xyz8 = xyz5 - XYZ.BasisY * AssistFunc.mmToFeet((double)((this.m_nFloorNum - 1) * this.m_nFloorGap) * this.m_dGain);
				XYZ xyz9 = xyz8 + XYZ.BasisX * AssistFunc.mmToFeet(150.0 * this.m_dGain);
				XYZ endPoint4 = xyz9 - XYZ.BasisY * AssistFunc.mmToFeet(50.0 * this.m_dGain);
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz8, xyz9));
				this.m_EmbedSteelLineInfos.Add(new JigEdgeInfoEx(xyz9, endPoint4));
			}
		}

		private void DrawCableTray()
		{
			XYZ xyz = this.m_ptBase - XYZ.BasisX * AssistFunc.mmToFeet(((double)this.m_nWidth * 0.5 - (double)this.m_nDisThick) * this.m_dGain) - XYZ.BasisY * AssistFunc.mmToFeet((double)(this.m_nBoardThick + this.m_nTopDis) * this.m_dGain);
			XYZ xyz2 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nLength - this.m_nTrayWidth) * 0.5 * this.m_dGain);
			if (this.m_strLeftOrRight.Contains("左"))
			{
				XYZ xyz3 = null;
				for (int i = 0; i < this.m_nFloorNum; i++)
				{
					XYZ xyz4 = xyz2 - XYZ.BasisY * AssistFunc.mmToFeet((double)(i * this.m_nFloorGap) * this.m_dGain);
					XYZ xyz5 = xyz4 + XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nTrayWidth * this.m_dGain);
					XYZ xyz6 = xyz4 + XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nTrayHeight * this.m_dGain);
					XYZ xyz7 = xyz5 + XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nTrayHeight * this.m_dGain);
					XYZ xyz8 = xyz6 + XYZ.BasisX * AssistFunc.mmToFeet(10.0 * this.m_dGain);
					XYZ endPoint = xyz7 - XYZ.BasisX * AssistFunc.mmToFeet(10.0 * this.m_dGain);
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz4, xyz6));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz6, xyz8));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz4, xyz5));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz5, xyz7));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz7, endPoint));
					if (i == 0)
					{
						xyz3 = xyz8;
					}
				}
				List<XYZ> list = new List<XYZ>();
				XYZ xyz9 = xyz3;
				list.Add(xyz9);
				xyz9 += XYZ.BasisY * AssistFunc.mmToFeet(150.0);
				list.Add(xyz9);
				JigTextInfo txtInfo = new JigTextInfo(this.m_dimTxtNoteType, xyz9 + XYZ.BasisY * AssistFunc.mmToFeet(80.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)128, AssistFunc.mmToFeet(2.0), "桥架");
				this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo, list));
			}
			XYZ xyz10 = xyz + XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nWidth - this.m_nDisThick * 2) * this.m_dGain) - XYZ.BasisX * AssistFunc.mmToFeet((double)(this.m_nLength - this.m_nTrayWidth) * 0.5 * this.m_dGain);
			if (this.m_strLeftOrRight.Contains("右"))
			{
				XYZ xyz11 = null;
				for (int j = 0; j < this.m_nFloorNum; j++)
				{
					XYZ xyz12 = xyz10 - XYZ.BasisY * AssistFunc.mmToFeet((double)(j * this.m_nFloorGap) * this.m_dGain);
					XYZ xyz13 = xyz12 - XYZ.BasisX * AssistFunc.mmToFeet((double)this.m_nTrayWidth * this.m_dGain);
					XYZ xyz14 = xyz12 + XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nTrayHeight * this.m_dGain);
					XYZ xyz15 = xyz13 + XYZ.BasisY * AssistFunc.mmToFeet((double)this.m_nTrayHeight * this.m_dGain);
					XYZ endPoint2 = xyz14 - XYZ.BasisX * AssistFunc.mmToFeet(10.0 * this.m_dGain);
					XYZ endPoint3 = xyz15 + XYZ.BasisX * AssistFunc.mmToFeet(10.0 * this.m_dGain);
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz12, xyz14));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz14, endPoint2));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz12, xyz13));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz13, xyz15));
					this.m_LCabelTrayLineInfos.Add(new JigEdgeInfoEx(xyz15, endPoint3));
					if (j == 0)
					{
						xyz11 = xyz15;
					}
				}
				if (!this.m_strLeftOrRight.Contains("左"))
				{
					List<XYZ> list2 = new List<XYZ>();
					XYZ xyz16 = xyz11;
					list2.Add(xyz16);
					xyz16 -= XYZ.BasisX * AssistFunc.mmToFeet(200.0);
					list2.Add(xyz16);
					JigTextInfo txtInfo2 = new JigTextInfo(this.m_dimTxtNoteType, xyz16 - XYZ.BasisX * AssistFunc.mmToFeet(150.0), XYZ.BasisX, XYZ.BasisY, (Autodesk.Revit.DB.TextAlignFlags)1024, AssistFunc.mmToFeet(1.0), "桥架");
					this.m_TextDimLst.Add(new CabelTrayTxtDim(txtInfo2, list2));
				}
			}
		}

		private FilledRegionType GetForwardDiagonal()
		{
			FilledRegionType filledRegionType = null;
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc);
			filteredElementCollector.OfClass(typeof(FilledRegionType));
			if (filteredElementCollector != null)
			{
				foreach (Element element in filteredElementCollector.ToElements())
				{
					if (element.Name == "HYForwardDiagonal")
					{
						filledRegionType = (element as FilledRegionType);
						break;
					}
				}
			}
			if (filledRegionType == null)
			{
				ElementId elementId = null;
				filledRegionType = ((filteredElementCollector.ToElements()[0] as FilledRegionType).Duplicate("HYForwardDiagonal") as FilledRegionType);
				FilteredElementCollector filteredElementCollector2 = new FilteredElementCollector(this.m_doc);
				filteredElementCollector2.OfClass(typeof(FillPatternElement));
				foreach (Element element2 in filteredElementCollector2.ToElements())
				{
					if (element2.Name == "上对角线_1.5mm")
					{
						elementId = element2.Id;
						break;
					}
				}
				if (elementId == null)
				{
					SubTransaction subTransaction = new SubTransaction(this.m_doc);
					subTransaction.Start();
					try
					{
						FillPattern fillPattern = new FillPattern("上对角线_1.5mm", 0, 0, 0.78539816339744828, AssistFunc.mmToFeet(1.5));
						Element element3 = FillPatternElement.Create(this.m_doc, fillPattern);
						subTransaction.Commit();
						elementId = element3.Id;
					}
					catch
					{
						subTransaction.RollBack();
						return null;
					}
				}
				RevitVersionFuncs.SetFillPatternId(ref filledRegionType, elementId);
			}
			return filledRegionType;
		}

		private FilledRegionType GetConcrete()
		{
			FilledRegionType filledRegionType = null;
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc);
			filteredElementCollector.OfClass(typeof(FilledRegionType));
			if (filteredElementCollector != null)
			{
				foreach (Element element in filteredElementCollector.ToElements())
				{
					if (element.Name == "HYConcrete")
					{
						filledRegionType = (element as FilledRegionType);
						break;
					}
				}
			}
			if (filledRegionType == null)
			{
				ElementId elementId = null;
				filledRegionType = ((filteredElementCollector.ToElements()[0] as FilledRegionType).Duplicate("HYConcrete") as FilledRegionType);
				FilteredElementCollector filteredElementCollector2 = new FilteredElementCollector(this.m_doc);
				filteredElementCollector2.OfClass(typeof(FillPatternElement));
				foreach (Element element2 in filteredElementCollector2.ToElements())
				{
					if (element2.Name == "混凝土")
					{
						elementId = element2.Id;
						break;
					}
				}
				if (elementId == null)
				{
					elementId = this.CopyFillPatternElement();
				}
				if (elementId == null)
				{
					return null;
				}
				RevitVersionFuncs.SetFillPatternId(ref filledRegionType, elementId);
			}
			return filledRegionType;
		}

		private List<JigEdgeInfo> GetJigEdgeInfoList(List<JigEdgeInfoEx> jigEdgeInfoEx)
		{
			List<JigEdgeInfo> list = new List<JigEdgeInfo>();
			foreach (JigEdgeInfoEx jigEdgeInfoEx2 in jigEdgeInfoEx)
			{
				list.Add(jigEdgeInfoEx2.m_JigEdgeInfo);
			}
			return list;
		}

		private void CreateLabel(Transform tranform, DimensionType dimType)
		{
			for (int i = 0; i < 6; i++)
			{
				ReferenceArray referenceArray = new ReferenceArray();
				CabelTrayDimension cabelTrayDimension = this.m_DimensionLst[i];
				foreach (ElementId elementId in cabelTrayDimension.m_elemIdAry)
				{
					DetailCurve detailCurve = this.m_doc.GetElement(elementId) as DetailCurve;
					referenceArray.Append(detailCurve.GeometryCurve.Reference);
				}
				XYZ startPoint = tranform.OfPoint(cabelTrayDimension.m_ptStart);
				XYZ endPoint = tranform.OfPoint(cabelTrayDimension.m_ptEnd);
				Line line = YJKLineEx.YJKGetBound(startPoint, endPoint);
				this.m_doc.Create.NewDimension(this.m_doc.ActiveView, line, referenceArray, dimType);
			}
		}

		private void CreateTextLabel(Transform tranform)
		{
			if (this.m_TextDimLst.Count <= 0)
			{
				return;
			}
			foreach (CabelTrayTxtDim cabelTrayTxtDim in this.m_TextDimLst)
			{
				JigTextInfo jigTxtInfo = cabelTrayTxtDim.jigTxtInfo;
				jigTxtInfo.TransformSelf(tranform, false);
				if (jigTxtInfo.StrText.CompareTo("") != 0)
				{
					try
					{
						TextNote textNode = this.m_doc.GetTextNode(this.m_doc.ActiveView, jigTxtInfo.Origin, jigTxtInfo.BaseVec, jigTxtInfo.UpVec, jigTxtInfo.LineWidth, jigTxtInfo.TextAlign, jigTxtInfo.StrText);
						if (textNode != null)
						{
							textNode.TextNoteType = jigTxtInfo.theTextNoteType;
						}
						for (int i = 0; i < cabelTrayTxtDim.lstPts.Count - 1; i++)
						{
							XYZ xyz = cabelTrayTxtDim.lstPts[i];
							XYZ xyz2 = cabelTrayTxtDim.lstPts[i + 1];
							xyz = tranform.OfPoint(xyz);
							xyz2 = tranform.OfPoint(xyz2);
							Line line = YJKLineEx.YJKGetBound(xyz, xyz2);
							this.m_doc.Create.NewDetailCurve(this.m_doc.ActiveView, line);
						}
					}
					catch (Exception)
					{
					}
				}
			}
		}

		private ElementId CopyFillPatternElement()
		{
			ElementId result = null;
			string versionNumber = RevitVersion.GetVersionNumber(this.m_doc);
			string text = Path.Combine(Product.FamilyLocation, versionNumber, "Template", "HYBIMSpace电气样板.rte");
			Document document = null;
			if (!File.Exists(text))
			{
				return null;
			}
			document = this.m_doc.Application.OpenDocumentFile(text);
			Element element = null;
			foreach (Element element2 in new FilteredElementCollector(document).OfClass(typeof(FillPatternElement)).ToElements())
			{
				if (element2.Name == "混凝土")
				{
					element = element2;
					break;
				}
			}
			if (element == null)
			{
				return null;
			}
			List<ElementId> list = new List<ElementId>();
			list.Add(element.Id);
			SubTransaction subTransaction = new SubTransaction(this.m_doc);
			subTransaction.Start();
			try
			{
				ICollection<ElementId> collection = ElementTransformUtils.CopyElements(document, list, this.m_doc, Transform.Identity, new CopyPasteOptions());
				subTransaction.Commit();
				if (collection.Count > 0)
				{
					result = collection.ElementAt(0);
				}
			}
			catch
			{
				subTransaction.RollBack();
			}
			document.Close();
			return result;
		}

		private DimensionType CopyDimensionType(string strLabel, string strMark)
		{
			DimensionType result = null;
			string versionNumber = RevitVersion.GetVersionNumber(this.m_doc);
			string text = Path.Combine(Product.FamilyLocation, versionNumber, "Template", "HYBIMSpace电气样板.rte");
			Document document = null;
			if (!File.Exists(text))
			{
				return null;
			}
			document = this.m_doc.Application.OpenDocumentFile(text);
			Element element = null;
			foreach (Element element2 in new FilteredElementCollector(document).OfClass(typeof(DimensionType)).ToElements())
			{
				if (element2.Name == strLabel)
				{
					element = element2;
					break;
				}
			}
			Element element3 = null;
			foreach (Element element4 in new FilteredElementCollector(document).OfClass(typeof(Autodesk.Revit.DB.ElementType)).ToElements())
			{
				if (element4.Name == strMark)
				{
					element3 = element4;
					break;
				}
			}
			if (element == null || element3 == null)
			{
				return null;
			}
			List<ElementId> list = new List<ElementId>();
			list.Add(element.Id);
			List<ElementId> list2 = new List<ElementId>();
			list2.Add(element3.Id);
			SubTransaction subTransaction = new SubTransaction(this.m_doc);
			subTransaction.Start();
			try
			{
				ICollection<ElementId> collection = ElementTransformUtils.CopyElements(document, list, this.m_doc, Transform.Identity, new CopyPasteOptions());
				ElementTransformUtils.CopyElements(document, list2, this.m_doc, Transform.Identity, new CopyPasteOptions());
				subTransaction.Commit();
				if (collection.Count > 0)
				{
					result = (this.m_doc.GetElement(collection.ElementAt(0)) as DimensionType);
				}
			}
			catch
			{
				subTransaction.RollBack();
			}
			document.Close();
			return result;
		}

		private const int CABLETRENCH_LINEWIDTH = 10;

		private ExternalCommandData m_cmdData;

		private Document m_doc;

		private XYZ m_ptBase = XYZ.Zero;

		private int m_nWidth;

		private int m_nDepth;

		private int m_nWallThick;

		private int m_nDisThick;

		private bool m_bEmbedSteel;

		private bool m_bGroundSteel;

		private int m_nLength;

		private int m_nFloorNum;

		private int m_nFloorGap;

		private int m_nTopDis;

		private string m_strLeftOrRight;

		private bool m_bHasBoard;

		private int m_nBoardThick;

		private int m_nBaseThick;

		private int m_nEdgeDis;

		private bool m_bHasCableTray;

		private int m_nTrayWidth;

		private int m_nTrayHeight;

		private bool m_bHasLabel;

		private double m_dGain;

		private GraphicsStyle m_CTBodyStyle;

		private GraphicsStyle m_WallStyle;

		private GraphicsStyle m_GroundSteelStyle;

		private GraphicsStyle m_EmbedSteelStyle;

		public const string m_strCTBodyStyle = "CTBody";

		public const string m_strWallStyle = "DisWall";

		public const string m_strGroundSteelStyle = "GroundSteel";

		public const string m_strEmbedSteelStyle = "EmbedSteel";

		private Autodesk.Revit.DB.Color m_CTBodyColor = new Autodesk.Revit.DB.Color(byte.MaxValue, byte.MaxValue, 0);

		private Autodesk.Revit.DB.Color m_WallColor = new Autodesk.Revit.DB.Color(0, byte.MaxValue, byte.MaxValue);

		private Autodesk.Revit.DB.Color m_GroundSteelColor = new Autodesk.Revit.DB.Color(byte.MaxValue, 0, byte.MaxValue);

		private Autodesk.Revit.DB.Color m_EmbedSteelColor = new Autodesk.Revit.DB.Color(byte.MaxValue, 0, 0);

		private List<JigEdgeInfoEx> m_TopLeftInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_TopRightInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_BoardInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_WallLeftInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_WallRightInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_BaseInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_LSupportInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_RSupportInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_DisWallLineInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_LGroudSteelLineInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_RGroudSteelLineInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_LCabelTrayLineInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_RCabelTrayLineInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfoEx> m_EmbedSteelLineInfos = new List<JigEdgeInfoEx>();

		private List<JigEdgeInfo> m_TopLeftRegion = new List<JigEdgeInfo>();

		private List<JigEdgeInfo> m_TopRightRegion = new List<JigEdgeInfo>();

		private const int BoardExtend = 40;

		private const int TopWidth = 440;

		private const int TopHeight = 150;

		private TextNoteType m_dimTxtNoteType;

		private List<CabelTrayDimension> m_DimensionLst;

		private List<CabelTrayTxtDim> m_TextDimLst;
	}
}
